package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/7/22 22:09
 * https://leetcode.cn/problems/range-sum-query-mutable/
 */
public class Title307 {

    private int[] nums;

    public Title307(int[] nums) {
        this.nums = nums;
    }

    public void update(int index, int val) {
        nums[index] = val;
    }

    public int sumRange(int left, int right) {
        int sum = 0;
        for (int i = left; i <= right; i++) {
            sum += nums[i];
        }
        return sum;
    }

    public static void main(String[] args) {

    }
}
